// 首页的js入口文件
require.config({
  baseUrl: "javascripts/library", // 基础路径
  paths: {
    jquery: "jquery",
    axios: "axios",
  },
  // shim用于管理第三方插件的依赖
  shim: {},
});

require(['axios','jquery'],(axios,$)=>{
  axios.get('./product/getitems').then((res)=>{
    // console.log(res.data);
    let data = res.data;

    let temp = '';
    let flag = 1;
    data.forEach(elm=>{
      let pic = JSON.parse(elm.picture);
      console.log(pic);
      
      temp += `<a href="./details.html?id=${elm.id}"  class="div${flag}">
      <p>爆款</p>
      <img src="../images/box2.2.webp" alt="">
      <p class="p2">${elm.title}</p>
      <p class="p3">2K超清画质 166°超广视角</p>
      <p class="p4"><span>￥${elm.price}</span> <span>￥429</span></p>
    </a>`;

    $('.floor-body1').html(temp);
    flag++;
    })


  }).catch(err=>{
    console.log(err);
  })
})